cmake_minimum_required(VERSION 3.19)
project(BMI8 LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Network)

qt_standard_project_setup()

qt_add_executable(BMI8
    WIN32 MACOSX_BUNDLE
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    deepseekapi.cpp
    deepseekapi.h
    aichatdialog.cpp
    aichatdialog.h
    apikeysdialog.cpp
    apikeysdialog.h
    trendwindow.cpp
    trendwindow.h
    advicewindow.cpp
    advicewindow.h
    inputwindow.cpp
    inputwindow.h
    resultwindow_new.cpp
    resultwindow.h
    goalwindow.cpp
    goalwindow.h
    userinfowindow.h
    userinfowindow.cpp
    historywindow.h
    inputwindow.cpp
    historywindow.cpp
)

target_link_libraries(BMI8
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt::Network
)

include(GNUInstallDirs)

install(TARGETS BMI8
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET BMI8
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
